<!--
 * @Author: your name
 * @Date: 2021-01-04 14:30:09
 * @LastEditTime: 2021-01-04 15:30:57
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \basiccss\fudong\clearFD1.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动1</title>
    <style>
        article{
            border: 2px solid #dddddd;
            overflow: hidden;
        }
        div{
            width: 200px;
            height: 200px;
            margin-bottom: 10px;
        }
        div.green{
            border: solid 2px green;
            float: left;
        }
        div.red{
            border: solid 2px red;
            float: left;
        }

        /*使用::after伪类为元素添加后标签，实现清除浮动*/
        /* article::after{
            content: '1212';
            clear: both;
            display: block;
        } */

        /*OVERFLOW子元素使用浮动后将不占用空间,这个时候父元素的高度为0，通过添加父元素并设置overflow属性可以清除浮动*/
        
        

        
       
    </style>
</head>
<body>
    <article>
        <div class="green"></div>
        <div class="red"></div>
    </article>
</body>
</html>